﻿
@{
	/**/

	ViewBag.Title = "Home Page";
}
<blockquote class="layui-elem-quote">
	<form id="form1" method="post" action="@Url.Action("Crawler")">
		<div>
			片名:<input type="text" id="key" name="key" /><button  class="layui-btn">1搜索 2收录 3看片</button>
			 
		</div>

	</form>
</blockquote>
<blockquote class="layui-elem-quote">
	<div id="view"></div>
</blockquote>
<div>
	<table id="demo" lay-filter="test"></table>

	<script type="text/html" id="titleTpl">
		{{#  if(d.VideoType ==0){ }}
		专辑(多 )
		{{#  } else { }}
		视频
		{{#  } }}
	</script>
	<script type="text/html" id="titleTp2">
		{{#  if(d.VideoType ==0){ }}
		<a href="aaa.aspx?purl={{d.Url}}" target="_blank" class="layui-table-link">{{d.Title}}</a>
		{{#  } else { }}
		<a href="http://jx.jqaaa.com/index.php?v={{d.Url}}" target="_blank" class="layui-table-link">{{d.Title}}</a>
		{{#  } }}
	</script>

	<script type="text/html" id="keyTp">
		{{#  layui.each(d.list, function(index, item){ }}
		<a href="#" class="layui-btn layui-btn-warm" onclick="getByName('{{item.Name}}')">{{item.Name}}</a>
		{{#  }); }}


	</script>
</div>
	<%--http://jx.jqaaa.com/index.php?v={{d.Url}}--%>
<script src="../assets/layui/2.2.5/layui.all.js"></script>
<script>
	var data = [];
	//一般直接写在一个js文件中
	layui.use(['layer', 'form', 'table', 'jquery'], function () {
		var layer = layui.layer
			, form = layui.form
			, table = layui.table
			, $ = layui.jquery
			, laytpl = layui.laytpl;

		$.getJSON('f.aspx', function (rsp) {



			//第三步：渲染模版
			var data = { //数据
				"Title": "Layui常用模块"
				, "list": rsp
			}
			var getTpl = keyTp.innerHTML
				, view = document.getElementById('view');
			laytpl(getTpl).render(data, function (html) {
				view.innerHTML = html;
			});
		});



		//第一个实例
		table.render({
			elem: '#demo'
			, url: 'aa.aspx' //数据接口
			, page: true //开启分页
			, cols: [[ //表头
				{ field: 'VideoType', title: '类型', templet: '#titleTpl' }
				, { field: 'Title', title: '片名', templet: '#titleTp2' }

			]],
			done: function (res, curr, count) {
				data = res.data;

			}
		});
	});


	function getByName(name) {

		$.post('', { name: name }, function (rsp) {


		});
	}

</script>